package org.hxyjs.dao.impl;

import org.hxyjs.dao.AdvertisingrecordDao;
import org.hxyjs.entity.Advertisingrecord;
import org.hxyjs.mapper.AdvertisingrecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("advertisingrecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class AdvertisingrecordDaoImpl implements AdvertisingrecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private AdvertisingrecordMapper advertisingrecordMapper;
    public List<Advertisingrecord>  getAllAdvertisingrecords() throws Exception{
        return advertisingrecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteAdvertisingrecordByAdrdno(String adrdno)  throws Exception{
        return advertisingrecordMapper.deleteByPrimaryKey(adrdno);
    }

    @Override
    public Integer updateAdvertisingrecordByAdrdno(Advertisingrecord advertisingrecord)  throws Exception{
        return advertisingrecordMapper.updateByPrimaryKey(advertisingrecord);
    }

    @Override
    public Integer addAdvertisingrecord(Advertisingrecord advertisingrecord)  throws Exception{
        return advertisingrecordMapper.insertSelective(advertisingrecord);
    }

}
